package logic

import (
	"context"
	"shop_srv/model/redis"

	"shop_srv/goods"
	"shop_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteGoodsStockLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDeleteGoodsStockLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteGoodsStockLogic {
	return &DeleteGoodsStockLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DeleteGoodsStockLogic) DeleteGoodsStock(in *goods.DeleteGoodsStockRequest) (*goods.DeleteGoodsStockResponse, error) {
	// todo: add your logic here and delete this line

	redis.OutStock(int(in.GoodsId), int(in.Num))

	return &goods.DeleteGoodsStockResponse{}, nil
}
